package com.samsonsoft.spring.web.controllers;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.samsonsoft.spring.web.dao.Actor;
import com.samsonsoft.spring.web.service.ActorsService;

@Controller
public class ActorsController {

	private ActorsService actorsService;
	
	@Autowired
	public void setActorsService(ActorsService actorsService) {
		this.actorsService = actorsService;
	}	
	@RequestMapping("/actors")
	public String showActors(Model model){
		
		List<Actor> actors = actorsService.getCurrent();
		model.addAttribute("actors", actors);
		
		model.addAttribute("name", "Tiffany");

		return "actors";
	}
	
	@RequestMapping("/createactor")
	public String createActor(){


		return "createactor";
	}

}
